import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
import { purgeCSSPlugin } from "@fullhuman/postcss-purgecss";

export default {
  plugins: [
    autoprefixer({}),
    tailwindcss({}),
    purgeCSSPlugin({
      content: ["./index.html", "**/*.html", "**/*.vue"],
      css: ["./src/**/*.css"],
      defaultExtractor: (content) => {
        const contentWithoutStyleBlocks = content.replace(
          /<style[^]+?<\/style>/gi,
          "",
        );
        return (
          contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) ||
          []
        );
      },
      skippedContentGlobs: ["./node_modules/**"],
    }),
  ],
};
